//
//  Fraction.h
//  02-ClassAndObjectHomeWork
//
//  Created by dllo on 16/7/5.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface Fraction : NSObject
/** 分子 */
@property (nonatomic, assign)NSInteger numerator;
/** 分母 */
@property (nonatomic, assign)NSInteger denominator;

//指定初始化
- (instancetype)initWithNumerator:(NSInteger)numerator
                      Denominator:(NSInteger)denominator;


//便利构造器
+ (instancetype)fractionWithNumerator:(NSInteger)numerator
                          Denominator:(NSInteger)denominator;

//得到约分后的分数
- (CGFloat)getFraction;
//得到最大公约数
- (NSInteger)getMax:(NSInteger)num1
               and:(NSInteger)num2;
//得到最小公倍数
- (NSInteger)getMin:(NSInteger)num1
               and:(NSInteger)num2;
//加法
- (void)add:(Fraction*)p
       and:(Fraction*)q;
//减法
- (void)cut:(Fraction*)p
       and:(Fraction*)q;
//乘法
- (void)product:(Fraction*)p
           and:(Fraction*)q;
//除法
- (void)divide:(Fraction*)p
          and:(Fraction*)q;
//比较大小
- (void)compare:(Fraction*)p
            and:(Fraction*)q;
@end
